﻿namespace System
{
    /// <summary>
    /// IntPtr扩展类
    /// </summary>
    public static class IntPtrEx
    {

        /// <summary>
        /// IntPtr相加
        /// </summary>
        /// <param name="a">第一个操作数</param>
        /// <param name="b">第二个操作数</param>
        /// <returns>结果</returns>
        public static IntPtr Add(IntPtr a, IntPtr b)
        {
            return new IntPtr((long)a + (long)b);
        }

        /// <summary>
        /// IntPtr相减
        /// </summary>
        /// <param name="a">第一个操作数</param>
        /// <param name="b">第二个操作数</param>
        /// <returns>结果</returns>
        public static IntPtr Subtract(IntPtr a, IntPtr b)
        {
            return new IntPtr((long)a - (long)b);
        }

        /// <summary>
        /// IntPtr相乘
        /// </summary>
        /// <param name="a">第一个操作数</param>
        /// <param name="b">第二个操作数</param>
        /// <returns>结果</returns>
        public static IntPtr Multiply(IntPtr a, IntPtr b)
        {
            return new IntPtr((long)a * (long)b);
        }

        /// <summary>
        /// IntPtr相除
        /// </summary>
        /// <param name="a">第一个操作数</param>
        /// <param name="b">第二个操作数</param>
        /// <returns>结果</returns>
        public static IntPtr Divide(IntPtr a, IntPtr b)
        {
            return new IntPtr((long)a / (long)b);
        }
    }


}
